<%@ page contentType="application/xhtml+xml;charset=utf-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="stripes" uri="http://stripes.sourceforge.net/stripes.tld"%>

<c:out value="Weekly view for ${year}/${week}"/><br/><br/>

<table id="calendar" border="1" cellspacing="5" cellpadding="3">
    <thead>
        <tr>
            <th>
                <c:out value="Dates"/>
            </th>
            <th>
                <c:out value="Total"/>
            </th>
            <c:forEach var="toolbox" items="${newKeysList}">
                <th>
                    <c:out value="${toolbox}"/>
                </th>
            </c:forEach>
        </tr>
    </thead>
    <tbody>
        <c:forEach var="date" items="${days}">
            <c:forEach var="coll" begin="1" end="${tableColls}">
                <c:if test="${coll mod tableColls == 1}">
                    <tr>
                        <td>
                            <c:out value="${date}"/>
                        </td>
                    </c:if>
                    <c:if test="${tableColls gt 2}">
                        <c:if test="${coll mod tableColls == 2}">
                            <c:set var="totalPos" value="${date}"/>
                            <td>
                                <c:out value="${view[totalPos]}"/>
                            </td>
                        </c:if>
                    </c:if>
                    <c:if test="${coll ge 3}">
                        <c:set var="toolbox" value="${newKeysList[coll-3]}"/>
                        <c:set var="pos" value="${date};${toolbox}"/>
                        <!--<c:set var="val" value="${view[pos]}"/>-->
                        <td>
                            <c:out value="${calendar[pos]}"/>
                        </td>
                    </c:if>
                    <c:if test="${coll mod tableColls == 0}">
                        <c:if test="${tableColls eq 2}">
                            <c:set var="totalPos" value="${year}${month}${d}"/>
                            <td>
                                <c:out value="${view[totalPos]}"/>
                            </td>
                        </c:if>
                    </tr>
                </c:if>
            </c:forEach>
        </c:forEach>
    </tbody>
</table>